﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SilverlightApplicationBibliothèquesLivres
{
    public class SingletonMots_Clefs
    {
        public static Mots_Clefs Mots_ClefsStatic = new Mots_Clefs();
    }

    public class Mots_Clefs
    {
        public Mot_Clef[] ListeMots_Clefs = new Mot_Clef[0];

        public Mots_Clefs()
        {
        }

        public void CreationListeMots_Clefs(Mot_Clef MC)
        {
            Mot_Clef[] temp = new Mot_Clef[ListeMots_Clefs.Length + 1];
            ListeMots_Clefs.CopyTo(temp, 0);
            temp[temp.Length - 1] = MC;
            ListeMots_Clefs = temp;
        }

        public void ChargerMots_Clefs()
        {
            /*
            ConnexionBDD.ConnectionBaseDonnées();

            ConnexionBDD.oDa.SelectCommand = ConnexionBDD.oConn.CreateCommand();
            ConnexionBDD.oDa.SelectCommand.CommandText = "SELECT*FROM Mots_Clefs;";
            DataSet ODS = new DataSet();
            ConnexionBDD.oDa.Fill(ODS, "Mots_Clefs");


            SingletonMots_Clefs.Mots_ClefsStatic = new Mots_Clefs();
            foreach (DataRow r in ODS.Tables[0].Rows)
            {
                Mot_Clef MC = new Mot_Clef();
                
                MC.N_MotClef = Convert.ToInt32(r[0]);
                MC.MotClef = r[1].ToString();

                SingletonMots_Clefs.Mots_ClefsStatic.CreationListeMots_Clefs(MC);
            }*/

            /*if (ListeUpdated != null)
            {
                ListeUpdated(this, new UpdateEventArgs("Charger"));
            }*/
        }

    }
}
